package com.zuilapsa.jmc.actions;

import com.zuilapsa.jmc.JmcException;
import com.zuilapsa.jmc.model.*;
import com.zuilapsa.jmc.userInterfaces.UserInterfaceSession;

public class ActionGet extends ActionNull {

	public void execute(UserInterfaceSession interfaceSession, String[] args)
			throws JmcException {
		if (args == null || args.length == 0) {
			interfaceSession.printMessageInfo(getHelpString());
		} else {
			String property = args[0];
			Level level = interfaceSession.getLevel();

			if (level.hasProperty(property))
				interfaceSession.printMessageInfo(property + " = "
						+ level.getProperty(property).getValue());
			else
				interfaceSession.printMessageInfo("no such property");
		}
	}

	public String getHelpString() {
		return "Prints property value";
	}
}
